package com.libraryManage.mapper;

import com.libraryManage.entity.BookManageDo;
import com.libraryManage.vo.BookManageVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface BookManageDoMapper {
    int deleteByPrimaryKey(Integer bookId);

    int insert(BookManageDo record);

    int insertSelective(BookManageDo record);

    BookManageDo selectByPrimaryKey(Integer bookId);

    int updateByPrimaryKeySelective(BookManageDo record);

    int updateByPrimaryKey(BookManageDo record);

    /**
     * 查询所有图书
     * @param vo
     * @return
     */
    List<BookManageVo> getList(BookManageVo vo);

    /**
     * 图书上架or下架
     * @param bookId
     * @param bookState
     */
    void updateBookState(int bookId, int bookState);

    /**
     * 更新图书基本信息
     * @param vo
     */
    void updateBookData(BookManageVo vo);

    /**
     * 获取热门书籍
     * @return
     */
    List<BookManageVo> getHotBook();

    void updateHotBook(@Param("hotState") int hotState,@Param("bookId") int bookId);

    /**
     * 图书库存+1
     * @param bookId
     */
    void addBookStock(int bookId);
}
